//用户相关接口

import request from '@/utils/request'
import type { LoginFormData, UserInfoResponseData } from './types'
import { AxiosResponse } from 'axios'
//统一管理接口
enum API {
  //登录接口
  LOGIN_URL = '/user/login',
  //获取用户信息接口
  USER_INFO_URL = '/user/info',
}

//暴露请求接口
//登录接口
export const reqLogin = async (data: LoginFormData): Promise<UserInfoResponseData> => {
  const res = await request.post<UserInfoResponseData>(API.LOGIN_URL, data)
  return res.data
}

//获取用户信息接口
export const reqUserInfo = async (): Promise<UserInfoResponseData> => {
  const res = await request.get<UserInfoResponseData>(API.USER_INFO_URL)
  return res.data
}
